A PTP (Precision Time Protocol) is known as a technique for synchronizing the times of a plurality of devices connected through a network with microsecond or better accuracy. The PTP is a protocol for realizing time synchronization by exchanging packets including time information between a master and a slave. The master is a device that manages a reference time, and the slave is a device that synchronizes the time of the slave with the time of the master.
An example of time synchronization by the PTP will be described with reference to FIG. 13. As illustrated in FIG. 13, the master uses a sync/follow_up message to notify the time of the master to the slave. After receiving the sync/follow_up message, the slave sets Time calculated by the following Expressions 1 and 2 as the time of the slave.offset=TSx−TMx−delay   Expression 1Time=Ts−offset   Expression 2
In this case, TMx denotes the time of the master notified by the sync/follow_up message. TSx denotes the time of the slave when the sync/follow_up message is received. Furthermore, delay denotes a transmission line delay, and 0 is set as an initial value. Ts denotes the current time of the slave.
In the example of FIG. 13, the time of the master notified to the slave by the sync/follow_up message is “10”, and the time of the slave upon the notification is “110”. Therefore, the slave sets the time of the slave to “10” at this point. Actually, there is a transmission line delay of “20” between the master and the slave. Therefore, the time set by the slave is delayed by “20” from the time of the master.
Subsequently, the slave transmits a delay_req message to the master to acquire the size of the transmission line delay between the master and the slave. After receiving the delay_req message, the master returns a delay_resp message, which includes the reception time of the delay_req message, to the slave. After receiving the delay_resp message, the slave sets a transmission line delay by the following Expression 3.delay=((TSx−TMx)+(TMy−TSy))/2   Expression 3
In this case, TSy denotes the time when the slave has transmitted the delay_req message to the master. TMy denotes the time when the master has received the delay_req message, and the slave acquires the time from the delay_resp message. Although TSx and TMx are the same as those in Expression 1, since the time of the slave is changed by the process, TSx is a value based on the changed time.
In the example of FIG. 13, the time that the slave has transmitted the delay_req message to the master is “50”, and the time included in the delay_resp message is “90”. Therefore, the slave sets delay to “20”.
As the slave acquires the size of delay, the master uses a sync/follow_up message to notify the time of the master to the slave again. After receiving the sync/follow_up message, the slave sets Time calculated by Expressions 1 and 2 as the time of the slave.
In the example of FIG. 13, the time of the master notified to the slave by the second sync/follow_up message is “110”. The time of the slave upon the notification is “110”, and the value of delay is “20” at this point. Therefore, the slave sets the time of the slave to “130” at this point. After that point, the times of the master and the slave are synchronized as illustrated in FIG. 13.
The PTP is a UDP (User Datagram Protocol) based protocol. An example of a technique related to the PTP for realizing similar functions as the PTP in layer 2 level is also known (for example, Japanese Laid-open Patent Publication NO. 2007-20183).
However, the time synchronization by the PTP does not appropriately function in some network environments. More specifically, the time synchronization by the PTP is based on the assumption that the time required for the transmission of a packet from the master to the slave is the same as the time required for the transmission of a packet from the slave to the master. Therefore, the times cannot be accurately synchronized by the PTP in an environment where the times do not match.
One of the typical environments in which the transmission times of PTP packets do not match is an environment in which the master and the slave are connected through a relay apparatus such as a switching hub and a layer 3 switch. The relay apparatuses internally buffer the packets and output the packets based on a certain priority. Therefore, a jitter may occur to the transmission times of the packets depending on the communication conditions.
The transmission time of a packet will be described with a specific example. FIG. 14 is an example of an ideal communication environment. In the environment illustrated in FIG. 14, a delay A generated by buffering the sync/follow_up message, a delay B generated by buffering the delay_req message, and a delay C generated by buffering the delay_resp message match in the relay apparatus. In such an environment, the time synchronization by the PTP appropriately functions.
FIG. 15 is an example of a communication environment in which the transmission times of packets do not match. In the environment illustrated in FIG. 15, the delay C is longer than the delays A and B. The increase in the delay C occurs when, for example, a large number of packets are transmitted from another apparatus to the relay apparatus when the delay_resp message is transmitted. In this case, the delay of the sync/follow_up message transmitted from the master to the slave after the delay_resp message is also extended as illustrated in FIG. 16. Therefore, the time synchronization may fail.